#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int check_time(void){
	int h1,m1,s1,h2,m2,s2,d=0;//d初始化为0 
	scanf("%d:%d:%d %d:%d:%d (+%d)",&h1,&m1,&s1,&h2,&m2,&s2,&d);//不输入d就为0 
	int time=d*24*3600+h2*3600+m2*60+s2-(h1*3600+m1*60+s1);//两个时间段之差 
	return time;
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int time1=check_time();
		int time2=check_time();
		int t=(time1+time2)/2;//来回时间相等  
		printf("%02d:%02d:%02d\n", t/3600, t/60%60, t%60);//格式化输出 
	}
	return 0;
}